home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _F55FBC98FB454FB78290DF2004F266EB < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.4 KB  |  55 lines

  1. // ===============================================================
  2. // Fragment Program: mutant refraction
  3. // Description: used in mutant stealth refraction
  4. // Last Update: 29/09/2003
  5. // Coder: Tiago Sousa
  6. // ===============================================================
  7.  
  8.  
  9. #include "../CGVPMacro.csi"
  10.  
  11. MainInput 
  12.     uniform sampler2D baseMap : texunit0,
  13. #ifdef OPENGL
  14.             uniform samplerRECT refMap : texunit1, 
  15. #endif
  16. #ifdef D3D
  17.             uniform sampler2D refMap : texunit1,
  18. #endif
  19.     uniform float4 Matrix
  20. }
  21.  
  22. DeclarationsScript
  23. {
  24.     OUT_T0_T1_C0
  25.     FOUT
  26. }
  27.  
  28. CoreScript
  29. {
  30.     // load the decal
  31.     float4 bumpColor = tex2D(baseMap, IN.Tex0.xy);
  32.     //float4 refrColor = tex2D(refMap, IN.Tex1.xy);
  33.  
  34. // must create 2 versions, since offsetRECT/samplerRECT must be used for gl version...
  35. #ifdef D3D
  36.  
  37.   #ifdef PROFILE_PS_1_1 
  38.     float4 refrColor = offsettex2D(refMap, IN.Tex1.xy, bumpColor, Matrix);                 // get env bump map   
  39.   #endif
  40.  
  41.   #ifdef OTHER
  42.         float2 newst = IN.Tex1.xy + Matrix.xy * bumpColor.xx + Matrix.zw * bumpColor.yy;
  43.         float4 refrColor = tex2D(refMap, newst);
  44.   #endif
  45.  
  46. #endif
  47.  
  48. #ifdef OPENGL
  49.     float4 refrColor = offsettexRECT(refMap, IN.Tex1.xy, bumpColor, Matrix);                 // get env bump map   
  50. #endif
  51.  
  52.     OUT.Color.xyz = saturate(refrColor.xyz+refrColor.xyz*0.1);
  53.     OUT.Color.a = IN.Color.w; 
  54. }